import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:dailypayagent/model/sales.dart';

class SalesItemWidget extends StatelessWidget {
  final Sales item;

  SalesItemWidget(this.item);

  @override
  Widget build(BuildContext context) {
    var backgroundColor = Theme.of(context).scaffoldBackgroundColor;
    return Stack(children: <Widget>[
      Material(
        color: backgroundColor,
        child: Container(
          padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
          decoration: BoxDecoration(
              border: Border(
            bottom: Divider.createBorderSide(context, width: 0.7),
          )),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.only(left: 10),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(item.saleName),
                    SizedBox(height: 5),
                    Text('登录账号:' + item.saleID)
                  ],
                ),
              ),
              Padding(
                padding: const EdgeInsets.only(right: 10),
                child: Text(
                  item.state == 1 ? '使用中' : '已冻结',
                  style: TextStyle(color: Colors.green),
                ),
              ),
            ],
          ),
        ),
      )
    ]);
  }
}
